<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes.jsp" %>

<html>

 <head>
    
    <title>库存汇总</title>
    <!-- import css and js -->
	<%@ include file="/common/meta.jsp" %>

		<script src="${ctx}/js/jsp/comm.js" type="text/javascript"></script>
		<script type="text/javascript">
		var basic_Url="${ctx}/yd/logic/whaffstockGather";
		var basic_WUrl="/yd/logic/whaffstockGather";
		var basic_Title="库存列表管理";
		var show_Width=950;
		var show_Hight=400;
		function createSearch(){
			init(2,8,'140,140,140,140','25%');
			//第一行的数据
			addCommon(0,0,"lable","物料编号");
			addCommon(0,1,"txtlike","aff.code");
			addCommon(0,2,"lable","物料名称");
			addCommon(0,3,"txtlike","aff.name");
			addCommon(0,4,"lable","仓库编码");
			addCommon(0,5,"txtlike","aff.whcode");
			addCommon(0,6,"lable","仓库名称");
			addCommon(0,7,"selectEnum","aff.whname","<option value=''>所有</option><c:forEach var="s" items="${wh}"><option id='${s.name}' value='${s.name}'>${s.name}</option></c:forEach>");
			multipleSearch("#table1",true,"",basic_Url+"/list.do");
		}
		function searchAP(){			
			multipleSearch("#table1",true,"",basic_Url+"/list.do");
		}
		
		function exportAP(){
			var filtersStr = generateCondition();
			var path = basic_Url+"/exportExcel.do?filters="+filtersStr+"&_search=true&isShowMoney=NO";
		   	window.open(path,"_blank");
		}
		
		
		
		
		jQuery(document).ready(function() {
			//创建JQGRID表格
			var grid = $("#table1").ligerGrid({
		        columns: [
		                  { display: '仓库编码', name: 'whCode', width: 120},
						  { display: '仓库', name: 'whname', width: 120},
		                  { display: '物料编号', name: 'code', width: 150 },
		                  { display: '物料名称', name: 'name', width: 100},
		                  { display: '型号', name: 'spec', width: 120},
		                  { display: '单位', name: 'unit', width: 100},
		                  { display: '一等品总数量', name: 'ydengquantity', width: 100 ,render:function(item){
		                	  
		                	  if(item.ydengquantity == null || item.ydengquantity == ''){
		                		  return '0.0';
		                	  }
		                	  return item.ydengquantity;
		                  }},
		                  { display: '次品总数量', name: 'quantity1', width: 60 ,render : function(row){
		                	  if(row.quantity1 == null || row.quantity1 == ''){
		                		  return '0.0';
		                	  }
		                	  return row.quantity1;
		                  }},
		                  { display: '旧件总数量', name: 'quantity2', width: 60 ,render : function(row){
		                	  if(row.quantity2 == null || row.quantity2 == ''){
		                		  return '0.0';
		                	  }
		                	  return row.quantity2;
		                  }},
		                  { display: '冻结总数量', name: 'hgquantity', width: 60 ,render : function(row){
		                	  if(row.hgquantity == null || row.hgquantity == ''){
		                		  return '0.0';
		                	  }
		                	  return row.hgquantity;
		                  }},
		                  { display: '在途总数量', name: 'bhgquantity', width: 60 ,render : function(row){
		                	  if(row.bhgquantity == null || row.bhgquantity == ''){
		                		  return '0.0';
		                	  }
		                	  return row.bhgquantity;
		                  }},
		                  { display: '总库存数量', name: 'quantity6', width: 60 ,render : function(row){
		                	  if(row.quantity6 == null || row.quantity6 == ''){
		                		  return '0.0';
		                	  }
		                	  return row.quantity6;
		                  }}
		                  ],  usePager: true,pageSize:15,pageSizeOptions :[15,30,45,60],enabledSort:false,
		                      url : basic_Url+"/list.do",
		                      width: '100%', height: '98%', checkbox: false,rownumbers:true
		                  });
			$("#pageloading").hide();
			
			
		});

	</script>
  </head>
<body onLoad="createSearch()">
   <div id="layout1">
      <div position="top">
      		<div class="panelBar">
          	<ul class="toolBar">
				   <li><a class="export" onclick="exportAP()"><span>导出</span></a></li>
               </ul>
          </div>
          <div id="pageHeader" class="pageHeader">
               <div class="searchBar" id="multipleSearchDialog">
	                <table class="table" width="100%" id="searchHeader" >  
                        <tbody id="newbody">
                        </tbody>
 	                </table>
                    <div class="subBar">
			             <ul>
				             <li><div class="buttonActive"><div class="buttonContent"><button type="submit" id="btnSearch" onclick="searchAP()">查询</button></div></div></li>
				             <li><a class="button" onclick="clearSearch()"><span>重置</span></a></li>
			             </ul>
	                </div>
               </div>
          </div>
      </div>
      <div position="center" id="table1">
      </div>
      <div class="clear"></div>
   </div>
</body>
</html>